package cn.jane.rpc.netty.nameservice;

import java.net.URI;
import java.util.HashMap;
import java.util.Set;

/**
 * 服务的元数据，是一个 {@link java.util.Map} 对象
 */
public class Metadata extends HashMap<String, Set<URI>> {

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("Metadata:\n");
        for (Entry<String, Set<URI>> entry : entrySet()) {
            sb
                    .append("\tServiceName: ").append(entry.getKey()).append("\n")
                    .append("\tServiceUri:").append("\n");
            for (URI serviceUri : entry.getValue()) {
                sb.append("\t  - ").append(serviceUri).append("\n");
            }
        }
        return sb.toString();
    }
}
